package com.ahzx.utils;

import com.ruoyi.common.utils.DateUtils;

import java.util.Date;

/**
 * @Author syg
 * @Date 2021/4/28 15:32
 * @Desc To be or not to be,that is a question.
 */
public class DateFormatter {

    /**
     * 2021-04-20 --> 20210420
     * @param startTime
     * @return
     */
    public static String startTimeFormatter(String startTime) {
        Date startDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD, startTime);
        return DateUtils.parseDateToStr(DateUtils.YYYYMMDD, startDate);
    }


    /**
     * 2021-04-20 --> 202104202359
     * @param endTime
     * @return
     */
    public static String endTimeFormatter(String endTime) {
        endTime = endTime + " 23:59:59";
        Date endDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, endTime);
        return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, endDate);
    }
}
